@page "/counter"
@attribute [TabItemOption(Text = "Counter")]

<PageTitle>Counter</PageTitle>

@*<h1>Counter</h1>

<p role="status">Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

<button class="btn btn-primary" @onclick="Insert">Insert</button>*@
<div>
    
    <text>标题</text><input @bind="question.Title"/>
    <text>分类</text><input @bind="question.Category"/>
    <text>标签</text><input @bind="question.Tag"/>
    <text>难度</text><input @bind="question.Difficulty"/>
    <text>简介</text><input @bind="question.Introduction"/>
    <text>答案</text><input @bind="question.Answer"/>
    <button @onclick="addQuestion">添加题目</button>
</div>
<div>
    <text>用户ID</text><input @bind="answerDetail.UserId"/>
    <text>题目ID</text><input @bind="answerDetail.QuestionId"/>
    <text>回答</text><input @bind="answerDetail.UserAnswer"/>
    <text>评分</text><input @bind="answerDetail.Score"/>
    <text>总评语</text><input @bind="answerDetail.OverallRemark"/>
    <text>详细评语</text><input @bind="answerDetail.DetailRemark"/>
    <button @onclick="addAnswer">添加回答</button>
</div>
<div>
    <text>用户ID</text><input @bind="comment.UserID"/>
    <text>题目ID</text><input @bind="comment.QuestionID"/>
    <text>评论</text><input @bind="comment.Content"/>
    <button @onclick="addComment">添加评论</button>>
</div>
<div>
    <text>用户名</text><input @bind="user.UserName">
    <text>密码</text><input @bind="user.Password">
    <text>昵称</text><input @bind="user.NickName">
    <text>头像</text><input @bind="user.Avatar">
    <text>个人简介</text><input @bind="user.Introduction">
    <button @onclick="addUser">添加用户</button>
</div>
<div>
    <text>用户ID</text><input @bind="star.UserID"/>
    <text>题目ID</text><input @bind="star.QuestionID"/>
    <button @onclick="addStar">添加收藏</button>
</div>
@code {
    private int currentCount = 0;
    private Question question = new Question();
    private AnswerDetail answerDetail = new AnswerDetail();
    private Comment comment= new Comment();
    private User user = new User();
    private StarList star= new StarList();

    private void IncrementCount()
    {
        currentCount++;
    }
    
    private void addQuestion()
    {
        question.Insert();
    }

    private void addAnswer()
    {
        answerDetail.Insert();    
    }
    private void addComment(){
        comment.Insert();
    }
    private void addUser(){ 
        user.Insert();
    }
    private void addStar(){
        star.Insert();
    }
}